﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Default.Master" AutoEventWireup="true"
  CodeBehind="GuaranteeInfo.aspx.cs" Inherits="SaleManagement.Web.Pages.GuaranteeInfo" %>

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
  Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register Assembly="DevExpress.Web.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
  Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dxpc" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
  Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
  Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<%@ Register Assembly="DevExpress.Web.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
  Namespace="DevExpress.Web.ASPxCallback" TagPrefix="dxcb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
  <asp:ScriptManager ID="ScriptManager2" runat="server">
  </asp:ScriptManager>
  <div id="divContent" runat="server">
    <table width="100%">
      <tr>
        <td class="search_header">
          Bảo hành sản phẩm
        </td>
      </tr>
      <tr>
        <td>
          <table border="0">
            <tr>
              <td style="height: 19px;">
                <asp:Literal ID="Literal5" runat="server" Text="Mã sản phẩm"></asp:Literal>
                :
              </td>
              <td style="height: 19px">
                <dxe:ASPxTextBox ID="txtProductCode" runat="server" Width="150px" ClientInstanceName="txtProductCode"
                  CssFilePath="~/App_Themes/Aqua/{0}/styles.css" CssPostfix="Aqua">
                  <ValidationSettings>
                    <ErrorImage Height="14px" Url="~/App_Themes/Aqua/Editors/edtError.png" />
                    <ErrorFrameStyle ImageSpacing="4px">
                      <ErrorTextPaddings PaddingLeft="4px" />
                    </ErrorFrameStyle>
                  </ValidationSettings>
                </dxe:ASPxTextBox>
              </td>
              <td style="padding-left: 10px;">
                <div style="float: left;">
                  <dxe:ASPxButton ID="btnSearch" runat="server" CssFilePath="~/App_Themes/Aqua/{0}/styles.css"
                    CssPostfix="Aqua" Text="Tìm kiếm" OnClick="btnSearch_OnClick" ClientInstanceName="btnSearch"
                    AutoPostBack="true">
                  </dxe:ASPxButton>
                </div>
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
  </div>
  <asp:UpdatePanel ID="upPurchaseInfo" UpdateMode="Conditional" runat="server">
    <ContentTemplate>
      <div style="padding-top: 10px; padding-bottom: 10px; width: 100%">
        <div style="float: left; width: 300px">
          <table width="100%">
            <tr>
              <td style="border-top: dashed 1px #000; border-left: dashed 1px #000; padding-left: 4px;">
                Mã khách hàng:
              </td>
              <td style="width: 180px; padding-left: 4px; border-top: dashed 1px #000; border-left: dashed 1px #000;
                border-right: dashed 1px #000;">
                <dxe:ASPxLabel CssFilePath="~/App_Themes/Aqua/{0}/styles.css" CssPostfix="Aqua" ID="lblCustomerCode"
                  ClientInstanceName="lblCustomerCode" runat="server">
                </dxe:ASPxLabel>
              </td>
            </tr>
            <tr>
              <td style="padding-top: 5px; border-top: dashed 1px #000; border-left: dashed 1px #000;
                padding-left: 4px;">
                Khách hàng:
              </td>
              <td style="padding-top: 5px; padding-left: 4px; border-top: dashed 1px #000; border-left: dashed 1px #000;
                border-right: dashed 1px #000;">
                <dxe:ASPxLabel CssFilePath="~/App_Themes/Aqua/{0}/styles.css" CssPostfix="Aqua" ID="lblClient"
                  ClientInstanceName="lblClient" runat="server">
                </dxe:ASPxLabel>
              </td>
            </tr>
            <tr>
              <td style="padding-top: 5px; border-top: dashed 1px #000; border-left: dashed 1px #000;
                padding-left: 4px;">
                Ngày mua hàng:
              </td>
              <td style="padding-top: 5px; padding-left: 4px; border-top: dashed 1px #000; border-left: dashed 1px #000;
                border-right: dashed 1px #000;">
                <dxe:ASPxLabel CssFilePath="~/App_Themes/Aqua/{0}/styles.css" CssPostfix="Aqua" ID="lblPurchaseDate"
                  ClientInstanceName="lblPurchaseDate" runat="server">
                </dxe:ASPxLabel>
              </td>
            </tr>
            <tr style="padding-top: 5px;">
              <td style="padding-top: 5px; border-top: dashed 1px #000; border-left: dashed 1px #000;
                padding-left: 4px;">
                Hạn bảo hành:
              </td>
              <td style="padding-top: 5px; padding-left: 4px; border-top: dashed 1px #000; border-left: dashed 1px #000;
                border-right: dashed 1px #000;">
                <dxe:ASPxLabel CssFilePath="~/App_Themes/Aqua/{0}/styles.css" CssPostfix="Aqua" ID="lblGuranteeDate"
                  ClientInstanceName="lblGuranteeDate" runat="server">
                </dxe:ASPxLabel>
              </td>
            </tr>
            <tr>
              <td style="padding-top: 5px; border-top: dashed 1px #000; border-left: dashed 1px #000;
                padding-left: 4px; border-bottom: dashed 1px #000;">
                Tình trạng:
              </td>
              <td style="padding-top: 5px; padding-left: 4px; border-bottom: dashed 1px #000; border-top: dashed 1px #000;
                border-left: dashed 1px #000; border-right: dashed 1px #000;">
                <dxe:ASPxLabel CssFilePath="~/App_Themes/Aqua/{0}/styles.css" CssPostfix="Aqua" ID="lblIsRemainGuarantee"
                  ForeColor="Red" ClientInstanceName="lblIsRemainGuarantee" runat="server">
                </dxe:ASPxLabel>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div style="padding-top: 130px; width: 100%">
        <dxwgv:ASPxGridView ID="gvGuarantee" runat="server" Width="100%" AutoGenerateColumns="False"
          CssFilePath="~/App_Themes/Aqua/{0}/styles.css" CssPostfix="Aqua" KeyFieldName="Id"
          OnCustomCallback="gvGuarantee_CustomCallback" ClientInstanceName="gvGuarantee"
          OnCustomJSProperties="gvGuarantee_CustomJSProperties" OnHtmlDataCellPrepared="gvGuarantee_HtmlDataCellPrepared">
          <SettingsBehavior AllowDragDrop="false" AllowSort="false" AllowGroup="False" />
          <Columns>
            <dxwgv:GridViewDataTextColumn Name="Command" VisibleIndex="0" Width="10%">
              <DataItemTemplate>
                <img src="../Images/edit.png" id="imgEdit" style="cursor: pointer" alt="" runat="server" />
              </DataItemTemplate>
              <CellStyle HorizontalAlign="Center">
              </CellStyle>
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn FieldName="ReceiveDate" VisibleIndex="1" Caption="Ngày bảo hành">
              <PropertiesTextEdit DisplayFormatString="dd/MM/yyyy" />
              <HeaderStyle HorizontalAlign="Center" />
              <CellStyle HorizontalAlign="Center">
              </CellStyle>
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn FieldName="AttendReturn" Caption="Ngày hẹn" VisibleIndex="2">
              <PropertiesTextEdit DisplayFormatString="dd/MM/yyyy" />
              <HeaderStyle HorizontalAlign="Center" />
              <CellStyle HorizontalAlign="Center">
              </CellStyle>
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn FieldName="ReturnDate" Caption="Ngày trả" VisibleIndex="2">
              <PropertiesTextEdit DisplayFormatString="dd/MM/yyyy" />
              <HeaderStyle HorizontalAlign="Center" />
              <CellStyle HorizontalAlign="Center">
              </CellStyle>
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn Width="15%" FieldName="ChargeFee" Caption="Phí" VisibleIndex="3">
              <HeaderStyle HorizontalAlign="Center" />
              <CellStyle HorizontalAlign="Right">
              </CellStyle>
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn Width="20%" FieldName="RepositoryName" VisibleIndex="5"
              Caption="Kho">
              <HeaderStyle HorizontalAlign="Center" />
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataMemoColumn Width="20%" FieldName="Notes" VisibleIndex="5" Caption="Ghi chú">
              <HeaderStyle HorizontalAlign="Center" />
            </dxwgv:GridViewDataMemoColumn>
            <dxwgv:GridViewDataMemoColumn FieldName="RepositoryId" Visible="false">
            </dxwgv:GridViewDataMemoColumn>
          </Columns>
          <Images ImageFolder="~/App_Themes/Aqua/{0}/">
            <HeaderSortDown Height="5px" Width="6px" Url="~/App_Themes/Aqua/GridView/gvHeaderSortDown.png" />
            <CollapsedButton Height="15px" Width="13px" Url="~/App_Themes/Aqua/GridView/gvCollapsedButton.png" />
            <ExpandedButton Height="15px" Width="13px" Url="~/App_Themes/Aqua/GridView/gvExpandedButton.png" />
            <DetailCollapsedButton Height="15px" Width="13px" Url="~/App_Themes/Aqua/GridView/gvDetailCollapsedButton.png" />
            <DetailExpandedButton Height="15px" Width="13px" Url="~/App_Themes/Aqua/GridView/gvDetailExpandedButton.png" />
            <HeaderFilter Height="19px" Url="~/App_Themes/Aqua/GridView/gvHeaderFilter.png" Width="19px" />
            <HeaderActiveFilter Height="19px" Url="~/App_Themes/Aqua/GridView/gvHeaderFilterActive.png"
              Width="19px" />
            <HeaderSortUp Height="5px" Width="6px" Url="~/App_Themes/Aqua/GridView/gvHeaderSortUp.png" />
            <FilterRowButton Height="13px" Width="13px" />
            <CustomizationWindowClose Width="18px" />
            <PopupEditFormWindowClose Width="18px" />
            <WindowResizer Height="13px" Width="12px" Url="~/App_Themes/Aqua/GridView/WindowResizer.png" />
            <FilterBuilderClose Width="18px" />
          </Images>
          <ClientSideEvents EndCallback="function(s, e) {
	ongvGuarantee_EndCallback(s,e);
}" />
          <StylesEditors>
            <ProgressBar Height="25px">
            </ProgressBar>
          </StylesEditors>
          <ImagesEditors>
            <CalendarPrevYear Width="23px" />
            <CalendarPrevMonth Width="19px" />
            <CalendarNextMonth Width="19px" />
            <CalendarNextYear Width="23px" />
            <CalendarFastNavPrevYear Height="19px" Url="~/App_Themes/Aqua/Editors/edtCalendarFNPrevYear.png" />
            <CalendarFastNavNextYear Height="19px" Url="~/App_Themes/Aqua/Editors/edtCalendarFNNextYear.png" />
            <DropDownEditDropDown Height="7px" Url="~/App_Themes/Aqua/Editors/edtDropDown.png"
              UrlDisabled="~/App_Themes/Aqua/Editors/edtDropDownDisabled.png" UrlHottracked="~/App_Themes/Aqua/Editors/edtDropDownHottracked.png" />
            <SpinEditIncrement Height="6px" Url="~/App_Themes/Aqua/Editors/edtSpinEditIncrementImage.png"
              UrlDisabled="~/App_Themes/Aqua/Editors/edtSpinEditIncrementDisabledImage.png" UrlHottracked="~/App_Themes/Aqua/Editors/edtSpinEditIncrementHottrackedImage.png"
              UrlPressed="~/App_Themes/Aqua/Editors/edtSpinEditIncrementHottrackedImage.png" />
            <SpinEditDecrement Height="7px" Url="~/App_Themes/Aqua/Editors/edtSpinEditDecrementImage.png"
              UrlDisabled="~/App_Themes/Aqua/Editors/edtSpinEditDecrementDisabledImage.png" UrlHottracked="~/App_Themes/Aqua/Editors/edtSpinEditDecrementHottrackedImage.png"
              UrlPressed="~/App_Themes/Aqua/Editors/edtSpinEditDecrementHottrackedImage.png" />
            <SpinEditLargeIncrement Height="9px" Url="~/App_Themes/Aqua/Editors/edtSpinEditLargeIncImage.png"
              UrlDisabled="~/App_Themes/Aqua/Editors/edtSpinEditLargeIncDisabledImage.png" UrlHottracked="~/App_Themes/Aqua/Editors/edtSpinEditLargeIncHottrackedImage.png"
              UrlPressed="~/App_Themes/Aqua/Editors/edtSpinEditLargeIncHottrackedImage.png" />
            <SpinEditLargeDecrement Height="9px" Url="~/App_Themes/Aqua/Editors/edtSpinEditLargeDecImage.png"
              UrlDisabled="~/App_Themes/Aqua/Editors/edtSpinEditLargeDecDisabledImage.png" UrlHottracked="~/App_Themes/Aqua/Editors/edtSpinEditLargeDecHottrackedImage.png"
              UrlPressed="~/App_Themes/Aqua/Editors/edtSpinEditLargeDecHottrackedImage.png" />
          </ImagesEditors>
          <Styles CssFilePath="~/App_Themes/Aqua/{0}/styles.css" CssPostfix="Aqua">
          </Styles>
          <SettingsLoadingPanel Text="" />
          <SettingsPager>
            <AllButton>
              <Image Height="19px" Width="28px" />
            </AllButton>
            <FirstPageButton>
              <Image Height="19px" Width="23px" />
            </FirstPageButton>
            <LastPageButton>
              <Image Height="19px" Width="23px" />
            </LastPageButton>
            <NextPageButton>
              <Image Height="19px" Width="19px" />
            </NextPageButton>
            <PrevPageButton>
              <Image Height="19px" Width="19px" />
            </PrevPageButton>
          </SettingsPager>
        </dxwgv:ASPxGridView>
      </div>
    </ContentTemplate>
    <Triggers>
      <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
    </Triggers>
  </asp:UpdatePanel>
  <div style="padding-top: 10px; clear: both; ">
    <dxe:ASPxButton ID="ASPxButton3" runat="server" ClientVisible="false" CssFilePath="~/App_Themes/Aqua/{0}/styles.css"
      CssPostfix="Aqua" Text="Thêm mới" ClientInstanceName="btnAdd">
      <Image Url="../Images/add.png" />
      <ClientSideEvents Click="function(s,e){onAdd(s,e);e.processOnServer=false;}" />
    </dxe:ASPxButton>
     <dxe:ASPxButton ID="btnBack" runat="server"  CssFilePath="~/App_Themes/Aqua/{0}/styles.css"
      CssPostfix="Aqua" Text="Trở về" ClientInstanceName="btnBack">
      <Image Url="../Images/undo.gif" />
      <ClientSideEvents Click="function(s,e){onBack();e.processOnServer=false;}" />
    </dxe:ASPxButton>
  </div>
  <dxpc:ASPxPopupControl ID="pcInfo" ClientInstanceName="pcInfo" runat="server" CssFilePath="~/App_Themes/Aqua/{0}/styles.css"
    CssPostfix="Aqua" ImageFolder="~/App_Themes/Aqua/{0}/" Width="600px" HeaderText="Thông tin bảo hành sản phẩm"
    Modal="True" PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter"
    AllowDragging="True" Height="250px">
    <SizeGripImage Height="12px" Width="12px" />
    <ContentCollection>
      <dxpc:PopupControlContentControl>
        <div>
          <dxe:ASPxLabel ID="lblErrorMessage" ClientInstanceName="lblErrorMessage" runat="server"
            Font-Bold="True" ForeColor="#FF3300">
          </dxe:ASPxLabel>
        </div>
        <table style="width: 100%">
          <tr>
            <td style="width: 100px;">
              Mã sản phẩm
            </td>
            <td>
              <dxe:ASPxTextBox ID="txtCode" runat="server" CssFilePath="~/App_Themes/Aqua/{0}/styles.css"
                CssPostfix="Aqua" ClientInstanceName="txtCode" Width="170px">
                <ValidationSettings>
                  <ErrorImage Height="14px" Url="~/App_Themes/Aqua/Editors/edtError.png" />
                  <ErrorFrameStyle ImageSpacing="4px">
                    <ErrorTextPaddings PaddingLeft="4px" />
                  </ErrorFrameStyle>
                </ValidationSettings>
              </dxe:ASPxTextBox>
            </td>
          </tr>
          <tr>
            <td style="width: 100px;">
              Ngày bảo hành
            </td>
            <td>
              <dxe:ASPxDateEdit runat="server" ShowShadow="False" ImageFolder="~/App_Themes/Aqua/{0}/"
                Width="170px" CssPostfix="Aqua" CssFilePath="~/App_Themes/Aqua/{0}/styles.css"
                ClientInstanceName="dexReceiveDate" ID="dexReceiveDate">
                <CalendarProperties>
                  <HeaderStyle Spacing="1px"></HeaderStyle>
                  <FooterStyle Spacing="17px"></FooterStyle>
                </CalendarProperties>
                <DropDownButton>
                  <Image UrlDisabled="~/App_Themes/Aqua/Editors/edtDropDownDisabled.png" UrlHottracked="~/App_Themes/Aqua/Editors/edtDropDownHottracked.png"
                    UrlPressed="~/App_Themes/Aqua/Editors/edtDropDownHottracked.png" Height="7px" Width="9px"
                    Url="~/App_Themes/Aqua/Editors/edtDropDown.png"></Image>
                </DropDownButton>
                <ValidationSettings>
                  <ErrorImage Height="14px" Width="14px" Url="~/App_Themes/Aqua/Editors/edtError.png">
                  </ErrorImage>
                  <ErrorFrameStyle ImageSpacing="4px">
                    <ErrorTextPaddings PaddingLeft="4px"></ErrorTextPaddings>
                  </ErrorFrameStyle>
                </ValidationSettings>
              </dxe:ASPxDateEdit>
            </td>
          </tr>
          <tr>
            <td style="width: 100px;">
              Ngày hẹn
            </td>
            <td>
              <dxe:ASPxDateEdit runat="server" ShowShadow="False" ImageFolder="~/App_Themes/Aqua/{0}/"
                Width="170px" CssPostfix="Aqua" CssFilePath="~/App_Themes/Aqua/{0}/styles.css"
                ClientInstanceName="dexAttend" ID="dexAttend">
                <CalendarProperties>
                  <HeaderStyle Spacing="1px"></HeaderStyle>
                  <FooterStyle Spacing="17px"></FooterStyle>
                </CalendarProperties>
                <DropDownButton>
                  <Image UrlDisabled="~/App_Themes/Aqua/Editors/edtDropDownDisabled.png" UrlHottracked="~/App_Themes/Aqua/Editors/edtDropDownHottracked.png"
                    UrlPressed="~/App_Themes/Aqua/Editors/edtDropDownHottracked.png" Height="7px" Width="9px"
                    Url="~/App_Themes/Aqua/Editors/edtDropDown.png"></Image>
                </DropDownButton>
                <ValidationSettings>
                  <ErrorImage Height="14px" Width="14px" Url="~/App_Themes/Aqua/Editors/edtError.png">
                  </ErrorImage>
                  <ErrorFrameStyle ImageSpacing="4px">
                    <ErrorTextPaddings PaddingLeft="4px"></ErrorTextPaddings>
                  </ErrorFrameStyle>
                </ValidationSettings>
              </dxe:ASPxDateEdit>
            </td>
          </tr>
          <tr>
            <td>
              Ngày trả máy:
            </td>
            <td>
              <dxe:ASPxDateEdit ID="dexReturnDate" ClientInstanceName="dexReturnDate" runat="server"
                CssFilePath="~/App_Themes/Aqua/{0}/styles.css" CssPostfix="Aqua" ImageFolder="~/App_Themes/Aqua/{0}/"
                ShowShadow="False" Width="170px">
                <ValidationSettings>
                  <ErrorImage Height="14px" Url="~/App_Themes/Aqua/Editors/edtError.png" Width="14px" />
                  <ErrorFrameStyle ImageSpacing="4px">
                    <ErrorTextPaddings PaddingLeft="4px" />
                  </ErrorFrameStyle>
                </ValidationSettings>
                <DropDownButton>
                  <Image Height="7px" Url="~/App_Themes/Aqua/Editors/edtDropDown.png" UrlDisabled="~/App_Themes/Aqua/Editors/edtDropDownDisabled.png"
                    UrlHottracked="~/App_Themes/Aqua/Editors/edtDropDownHottracked.png" UrlPressed="~/App_Themes/Aqua/Editors/edtDropDownHottracked.png"
                    Width="9px" />
                </DropDownButton>
                <CalendarProperties>
                  <HeaderStyle Spacing="1px" />
                  <FooterStyle Spacing="17px" />
                </CalendarProperties>
              </dxe:ASPxDateEdit>
            </td>
          </tr>
          <tr>
            <td>
              Lưu kho:
            </td>
            <td>
              <dxe:ASPxComboBox ID="cbxRepository" runat="server" ClientInstanceName="cbxRepository"
                CssFilePath="~/App_Themes/Aqua/{0}/styles.css" CssPostfix="Aqua" ImageFolder="~/App_Themes/Aqua/{0}/"
                LoadingPanelText="" ShowShadow="False" TextField="Name" ValueField="Id" ValueType="System.Int32">
                <DropDownButton>
                  <Image Height="7px" Url="~/App_Themes/Aqua/Editors/edtDropDown.png" UrlDisabled="~/App_Themes/Aqua/Editors/edtDropDownDisabled.png"
                    UrlHottracked="~/App_Themes/Aqua/Editors/edtDropDownHottracked.png" UrlPressed="~/App_Themes/Aqua/Editors/edtDropDownPressed.png"
                    Width="9px" />
                </DropDownButton>
                <ButtonEditEllipsisImage Height="3px" Url="~/App_Themes/Aqua/Editors/edtEllipsis.png"
                  UrlDisabled="~/App_Themes/Aqua/Editors/edtEllipsisDisabled.png" UrlHottracked="~/App_Themes/Aqua/Editors/edtEllipsisHottracked.png"
                  UrlPressed="~/App_Themes/Aqua/Editors/edtEllipsisPressed.png" Width="12px" />
                <ValidationSettings>
                  <ErrorImage Height="14px" Url="~/App_Themes/Aqua/Editors/edtError.png" Width="14px" />
                  <ErrorFrameStyle ImageSpacing="4px">
                    <ErrorTextPaddings PaddingLeft="4px" />
                  </ErrorFrameStyle>
                </ValidationSettings>
              </dxe:ASPxComboBox>
            </td>
          </tr>
          <tr>
            <td>
              Phí bảo hành:
            </td>
            <td>
              <dxe:ASPxTextBox ID="txtChargeFee" runat="server" CssFilePath="~/App_Themes/Aqua/{0}/styles.css"
                CssPostfix="Aqua" ClientInstanceName="txtChargeFee" Width="170px">
                <ValidationSettings>
                  <ErrorImage Height="14px" Url="~/App_Themes/Aqua/Editors/edtError.png" />
                  <ErrorFrameStyle ImageSpacing="4px">
                    <ErrorTextPaddings PaddingLeft="4px" />
                  </ErrorFrameStyle>
                </ValidationSettings>
                <MaskSettings IncludeLiterals="None" Mask="&lt;0..9999999999999999999g&gt;" />
              </dxe:ASPxTextBox>
            </td>
          </tr>
          <tr>
            <td>
              Nội dung bảo hành:
            </td>
            <td>
              <dxe:ASPxMemo ID="mmNote" ClientInstanceName="mmNote" runat="server" Height="71px"
                Width="100%" CssFilePath="~/App_Themes/Aqua/{0}/styles.css" CssPostfix="Aqua">
                <ValidationSettings>
                  <ErrorImage Url="~/App_Themes/Aqua/Editors/edtError.png" />
                  <ErrorFrameStyle ImageSpacing="4px">
                    <ErrorTextPaddings PaddingLeft="4px" />
                  </ErrorFrameStyle>
                </ValidationSettings>
              </dxe:ASPxMemo>
            </td>
          </tr>
          <tr>
            <td>
            </td>
            <td style="padding-top: 10px;">
              <div style="float: left">
                <dxe:ASPxButton ID="ASPxButton2" runat="server" AutoPostBack="False" CssFilePath="~/App_Themes/Aqua/{0}/styles.css"
                  CssPostfix="Aqua" Text="Lưu">
                  <Image Url="../Images/save.png" />
                  <ClientSideEvents Click="function(s,e){onSave(s,e);}" />
                </dxe:ASPxButton>
              </div>
              <div style="float: left; padding-left: 3px;">
                <dxe:ASPxButton ID="btnCancel" runat="server" AutoPostBack="False" CssFilePath="~/App_Themes/Aqua/{0}/styles.css"
                  CssPostfix="Aqua" Text="Đóng">
                  <Image Url="../Images/cancel.png" />
                  <ClientSideEvents Click="function(s, e) {
	                            pcInfo.Hide(); e.processOnServer = false;
                      }" />
                </dxe:ASPxButton>
              </div>
            </td>
          </tr>
        </table>
        <asp:HiddenField ID="hfGuaranteeId" runat="server" />
      </dxpc:PopupControlContentControl>
    </ContentCollection>
    <CloseButtonImage Height="16px" Width="17px" />
    <HeaderStyle Font-Bold="True" ForeColor="#59A1EF" />
  </dxpc:ASPxPopupControl>
  <dxcb:ASPxCallback ID="cbGuarantee" ClientInstanceName="cbGuarantee" runat="server">
    <ClientSideEvents CallbackComplete="function(s,e){
        OnCbGuaranteeCallbackComplete(s,e);
        }" />
  </dxcb:ASPxCallback>

  <script type="text/javascript" language="javascript">




    function OnCbGuaranteeCallbackComplete(s, e) {
      pcWaiting.Hide();
      var error = e.result.split('|');
      if (error[0] == 'error') {
        alert(error[1]);
      }
      else {
        alert('Cập nhật thành công');

      }
    }

    function onbtnSearch(s, e) {
      gvGuarantee.PerformCallback('Load');
    }

    function onSave(s, e) {
      if (checkInput()) {
        gvGuarantee.PerformCallback('Save');
      }
    }

    function checkInput() {
      var error = '';
      var code = txtCode.GetText();
      if (code == '') {
        error += '+ Mã sản phẩm không được bỏ trống.' + '<BR>';
      }

      if (dexReceiveDate.GetValue() == '' || dexReceiveDate.GetValue() == null) {
        error += '+ Ngày nhận máy không được bỏ trống.' + '<BR>';
      }
      else {
        if (dexReturnDate.GetValue() != null && dexReturnDate.GetDate() < dexReceiveDate.GetDate()) {
          error += '+ Ngày trả máy không được nhỏ hơn ngày nhận máy.' + '<BR>';
        }
      }

      if (cbxRepository.GetValue() == null) {
        error += '+ Kho lưu không được bỏ trống.' + '<BR>';
      }

      if (error != '') {
        lblErrorMessage.SetText(error);
        return false;
      }
      return true;
    }



    function fillWithInfo(rowIndex) {
      gvGuarantee.GetRowValues(rowIndex, "Id;ReceiveDate;ReturnDate;RepositoryId;ChargeFee;Notes;AttendReturn", OnReturnValue);
    }

    function OnReturnValue(values) {
    
      document.getElementById('<%=hfGuaranteeId.ClientID %>').value = values[0];
      txtCode.SetText(txtProductCode.GetText());
      dexReceiveDate.SetValue(values[1]);
      dexReturnDate.SetValue(values[2]);
      cbxRepository.SetValue(values[3]);
      var chargeeFee = String(values[4]);
      txtChargeFee.SetValue(chargeeFee);
      //txtChargeFee.SetText(values[4]);
      mmNote.SetText(values[5]);
      dexAttend.SetValue(values[6]);
      pcInfo.Show();
    }

    function onAdd() {
      txtCode.SetText(txtProductCode.GetText());
      dexReceiveDate.SetValue(null);
      dexReturnDate.SetValue(null);
      cbxRepository.SetValue(null);
      dexAttend.SetValue(null);
      txtChargeFee.SetValue('');
      mmNote.SetText('');
      pcInfo.Show();
    }


    function ongvGuarantee_EndCallback(s, e) {
      var para = gvGuarantee.cpInnerProperty;
      if (para == "Save") {
        pcInfo.Hide();
        var error = gvGuarantee.cpInnerError;
        if (error != '') {
          alert(error);
        }
      }
    }

    function onBack() {
      window.location.href = document.referrer;
    }
  </script>

</asp:Content>
